package com.novel.frame.lgw;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.WindowConstants;

import com.novel.frame.lgw.Reptile.Test;
import com.novel.frame.lxf.Login_Panel;
import com.novel.frame.wxl.ClickLaterFrame;

/**
 * 书库
 */
public class StackRoom extends JFrame {
	private JScrollPane sp_center;// 总滚动面板
	private JPanel pl_ALL;// 总面板
	/*
	 * 上部固定面板
	 */
	private JPanel pl_north;// 上部固定面板
	private JPanel pl_north_north;// 上部固定面板上部
	private JLabel lb_BookSeaGirlNet;// 书海女生网按钮
	private JLabel lb_BookSeaGirlNetPart;// 书海女生网按钮隔开线
	private JLabel lb_BookSeaLiteratureNet;// 书海文学网按钮
	private JLabel lb_BookSeaLiteratureNetPart;// 书海文学网按钮隔开线
	private JLabel lb_BookSeaComicNet;// 书海动漫网按钮
	private JLabel lb_register;// 注册按钮
	private JLabel lb_registerPart;// 注册按钮隔开线
	private JLabel lb_help;// 帮助按钮
	private JLabel lb_helpPart;// 帮助按钮隔开线
	private JLabel lb_north_login;// 登录按钮
	private JLabel lb_north_loginPart;// 登录按钮隔开线
	private JLabel lb_Client;// 客户端按钮
	private JPanel pl_north_center;// 上部固定面板中部
	private JLabel lb_BooksSea;// 书海标签
	private JLabel lb_HotSearch;// 热搜标签
	private JTextField tf_Search;// 搜索文本域
	private JLabel lb_Search;// 搜索按钮
	private JLabel lb_SearchTips;// 搜索提示
	private JLabel lb_Recharge;// 充值按钮
	private JLabel lb_WritersCenter;// 作家中心按钮
	private JLabel lb_center_loginMail;// 中部登录邮件图像
	private JLabel lb_center_loginHeadPicture;// 中部登录头像
	private JPanel pl_north_south;// 上部固定面板下部
	private JLabel lb_FirstPage;// 首页按钮
	private JLabel lb_FirstPagePart;// 首页按钮隔开线
	private JLabel lb_StackRoom;// 书库按钮
	private JLabel lb_StackRoomPart;// 书库按钮隔开线
	private JLabel lb_Ranking;// 排行按钮
	private JLabel lb_RankingPart;// 排行按钮隔开线
	private JLabel lb_IpSpecialArea;// IP专区按钮
	private JLabel lb_IpSpecialAreaPart;// IP专区按钮隔开线
	private JLabel lb_WriterWelfare;// 作家福利按钮
	private JLabel lb_WriterWelfarePart;// 作家福利按钮隔开线
	private JLabel lb_AnnounceInformation;// 公告资讯按钮
	private JLabel lb_AnnounceInformationPart;// 公告资讯按钮隔开线
	private JLabel lb_GirlSpecialArea;// 女生专区按钮
	private JLabel lb_GirlSpecialAreaPart;// 女生专区按钮隔开线
	private JLabel lb_MyBookShelf;// 我的书架按钮
	/*
	 * =============================================================================
	 * ======= 中部面板
	 */
	private JPanel jp_StackRoom_center;// 中部面板
	private JLabel jl_StackRoomCer_introduce;// 书库介绍标签
	private JPanel jp_StackRoomCer_SortMenu;// 排序面板菜单
	private JLabel[] jl_SortMenu_One;// 按" "组件
	private JLabel[] jl_SortMenu_Two;// 周 月 总==组件
	private JPanel jp_StackRoomCer_Type;// 类型菜单面板
	private JPanel[] jp_Type_One;// 类型面板
	private JLabel[] jl_Type_One;// 类型标签
	private JButton[] jb_StackRoom_sort;// 分类
	private JButton[] jb_StackRoom_state;// 状态
	private JButton[] jb_StackRoom_attribute;// 属性
	private JButton[] jb_StackRoom_wordNum;// 字数
	private JPanel jp_StackRoomCer_Display;// 展示面板菜单
	private JPanel[] jp_StackRoomDisplay_content;// 展示内容
	private JPanel[] jp_StackRoomDisplay_img;// 展示图片
	private JLabel[] jl_Type_im;// 图片标签
	private ImageIcon[] im;// 小说图片
	private JLabel[] jl_novel_name;// 小说名字
	private static List<String> listName;
	private static List<String> listSynopsis;
	private static List<String> listType;
	private static List<String> listNum;
	private static List<String> ListUpdate;
	private static List<String> ListState;
	private JTextArea[] jt_novel_synopsis;// 小说简介
	private JLabel[] jl_novel_type;// 小说类型
	private JLabel[] jl_novel_totalNum;// 总字数
	private JLabel[] jl_novel_updateTime;// 更新时间
	private JLabel[] jl_novel_state;// 状态
	private JPanel jp_StackRoomCer_Change;// 切换面板
	private JButton[] jb_StackRoomChange_page;// 切换页码
	private JLabel jl_page_ellipsis;// 页码省略号
	private JButton[] jb_page_change;// 页码切换 上一页 下一页
	private JLabel jl_page_total;// 总共
	private JPanel jp_StackRoom_south;// 南部
	Cursor cursor = new Cursor(Cursor.HAND_CURSOR);// 设置小手
	private static final long serialVersionUID = 1L;
	
	
    	
	int i = 0;
	@SuppressWarnings("serial")
	public StackRoom(String username,boolean flag) {
		// 设置总布局
		setLayout(new BorderLayout());
		setIconImage(Toolkit.getDefaultToolkit().createImage(StackRoom.class.getResource("书库主题.jpg")));
		// 获取屏幕分辨率
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
		// 界面总面板
		pl_ALL = new JPanel();
		pl_ALL.setLayout(new BorderLayout());
		pl_ALL.setPreferredSize(new Dimension(dimension.width, (int) (dimension.height * 2.6)));
		// 滑动总面板
		sp_center = new JScrollPane();
		sp_center.getVerticalScrollBar().setUnitIncrement(20);
		JScrollBar jsb =sp_center.getVerticalScrollBar();
		 jsb.setValue( jsb.getMinimum());
		sp_center.getViewport().add(pl_ALL);
		add(sp_center);

		// 北部总面板
		pl_north = new JPanel();
		pl_north.setLayout(new BorderLayout());
		pl_north.setPreferredSize(new Dimension(0, (int) (dimension.height * 0.2)));
		pl_north.setBackground(Color.white);
		pl_ALL.add(BorderLayout.NORTH, pl_north);
		// 北部面板组件
		StackRoomCommon(dimension.width, dimension.height,username,flag);

		// 中部面板
		jp_StackRoom_center = new JPanel();
		jp_StackRoom_center.setLayout(null);
		pl_ALL.add(BorderLayout.CENTER, jp_StackRoom_center);
		// 中部面板组件
		StackRoomCenter(dimension.width, dimension.height,username,flag);

		// 南部面板
		ImageIcon im_StackRoom_south = new ImageIcon(StackRoom.class.getResource("书库底部.png"));
		jp_StackRoom_south = new JPanel() {
			@Override
			public void paint(Graphics g) {
				Image i = im_StackRoom_south.getImage();
				g.drawImage(i, 0, 0, this);
			}
		};
		jp_StackRoom_south.setPreferredSize(new Dimension(0, im_StackRoom_south.getIconHeight()));
		pl_ALL.add(jp_StackRoom_south, BorderLayout.SOUTH);
		setTitle("书库");
		setSize(dimension.width, dimension.height);// 设置大小
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);// 设置可关闭
		setLocationRelativeTo(null);// 居中
		setVisible(true);// 设置可见
	}

	// 公共界面
	public void StackRoomCommon(int ScreenWidth, int ScreenHeight,String username,boolean flag) {
		// 上部面板上部
		pl_north_north = new JPanel();
		pl_north_north.setLayout(null);
		pl_north_north.setPreferredSize(new Dimension(0, (int) (ScreenHeight * 0.2 * 0.2)));
		pl_north.add(BorderLayout.NORTH, pl_north_north);
		Font font = new Font("微软雅黑", Font.PLAIN, 12);

		// 书海女神网按钮
		lb_BookSeaGirlNet = new JLabel("书海女生网");
		lb_BookSeaGirlNet.setFont(font);
		lb_BookSeaGirlNet.setForeground(Color.black);
		lb_BookSeaGirlNet.setBounds((int) (ScreenWidth * 0.125), (int) (ScreenHeight * 0.2 * 0.2 * 0), 75, 30);
		pl_north_north.add(lb_BookSeaGirlNet);

		// 书海女神网按钮隔开线
		lb_BookSeaGirlNetPart = new JLabel("|");
		lb_BookSeaGirlNetPart.setFont(font);
		lb_BookSeaGirlNetPart.setForeground(Color.black);
		lb_BookSeaGirlNetPart.setBounds((int) (ScreenWidth * 0.175), (int) (ScreenHeight * 0.2 * 0.2 * 0), 75, 30);
		pl_north_north.add(lb_BookSeaGirlNetPart);

		// 书海文学网按钮
		lb_BookSeaLiteratureNet = new JLabel("书海文学网");
		lb_BookSeaLiteratureNet.setFont(font);
		lb_BookSeaLiteratureNet.setForeground(Color.black);
		lb_BookSeaLiteratureNet.setBounds((int) (ScreenWidth * 0.185), (int) (ScreenHeight * 0.2 * 0.2 * 0), 75, 30);
		pl_north_north.add(lb_BookSeaLiteratureNet);

		// 书海女神网按钮隔开线
		lb_BookSeaLiteratureNetPart = new JLabel("|");
		lb_BookSeaLiteratureNetPart.setFont(font);
		lb_BookSeaLiteratureNetPart.setForeground(Color.black);
		lb_BookSeaLiteratureNetPart.setBounds((int) (ScreenWidth * 0.235), (int) (ScreenHeight * 0.2 * 0.2 * 0), 75,
				30);
		pl_north_north.add(lb_BookSeaLiteratureNetPart);

		// 书海动漫网按钮
		lb_BookSeaComicNet = new JLabel("书海动漫网");
		lb_BookSeaComicNet.setFont(font);
		lb_BookSeaComicNet.setForeground(Color.black);
		lb_BookSeaComicNet.setBounds((int) (ScreenWidth * 0.245), (int) (ScreenHeight * 0.2 * 0.2 * 0), 75, 30);
		pl_north_north.add(lb_BookSeaComicNet);

		// 注册按钮
		lb_register = new JLabel("");		
		if (flag) {	
			lb_register.setText(username);			
		}else {
			lb_register.setText("注册");
		}
		lb_register.setFont(font);
		lb_register.setForeground(Color.black);
		lb_register.setBounds((int) (ScreenWidth * 0.719), (int) (ScreenHeight * 0.2 * 0.2 * 0), 40, 30);
		pl_north_north.add(lb_register);
		// 注册按钮隔开线
		lb_registerPart = new JLabel("|");
		lb_registerPart.setFont(font);
		lb_registerPart.setForeground(Color.black);
		lb_registerPart.setBounds((int) (ScreenWidth * 0.745), (int) (ScreenHeight * 0.2 * 0.2 * 0), 10, 30);
		pl_north_north.add(lb_registerPart);
		// 登录按钮
		lb_north_login = new JLabel("");	
		if (flag) {	
			lb_north_login.setText("退出");
		}else {
			lb_north_login.setText("登录");
			lb_north_login.setForeground(Color.red);
		}
		lb_north_login.setBounds((int) (ScreenWidth * 0.754), (int) (ScreenHeight * 0.2 * 0.2 * 0), 40, 30);
		lb_north_login.setFont(font);		
		lb_north_login.setCursor(cursor);
		pl_north_north.add(lb_north_login);
		
		// 登录按钮隔开线
		lb_north_loginPart = new JLabel("|");
		lb_north_loginPart.setFont(font);
		lb_north_loginPart.setForeground(Color.black);
		lb_north_loginPart.setBounds((int) (ScreenWidth * 0.78), (int) (ScreenHeight * 0.2 * 0.2 * 0), 50, 30);
		pl_north_north.add(lb_north_loginPart);
		// 帮助按钮
		lb_help = new JLabel("帮助");
		lb_help.setFont(font);
		lb_help.setForeground(Color.black);
		lb_help.setBounds((int) (ScreenWidth * 0.79), (int) (ScreenHeight * 0.2 * 0.2 * 0), 50, 30);
		pl_north_north.add(lb_help);
		// 帮助按钮隔开线
		lb_helpPart = new JLabel("|");
		lb_helpPart.setFont(font);
		lb_helpPart.setForeground(Color.black);
		lb_helpPart.setBounds((int) (ScreenWidth * 0.815), (int) (ScreenHeight * 0.2 * 0.2 * 0), 50, 30);
		pl_north_north.add(lb_helpPart);
		// 客户端按钮
		lb_Client = new JLabel("客户端");
		lb_Client.setFont(font);
		lb_Client.setForeground(Color.black);
		lb_Client.setBounds((int) (ScreenWidth * 0.825), (int) (ScreenHeight * 0.2 * 0.2 * 0), 50, 30);
		pl_north_north.add(lb_Client);
		// 上部面板中部
		pl_north_center = new JPanel();
		pl_north_center.setLayout(null);
		pl_north_center.setBackground(Color.white);
		pl_north.add(BorderLayout.CENTER, pl_north_center);
		// 上部面板中部书海图片
		lb_BooksSea = new JLabel();
		ImageIcon im_BooksSea = new ImageIcon(StackRoom.class.getResource("书库书海标题.png"));
		lb_BooksSea.setIcon(im_BooksSea);
		lb_BooksSea.setBounds((int) (ScreenWidth * 0.105), (int) (ScreenHeight * 0.2 * 0.6 * 0.2),
				im_BooksSea.getIconWidth(), im_BooksSea.getIconHeight());
		pl_north_center.add(lb_BooksSea);
		// 上部面板热搜图片
		lb_HotSearch = new JLabel();
		lb_HotSearch.setIcon(new ImageIcon(StackRoom.class.getResource("书库热搜.png")));
		lb_HotSearch.setBounds((int) (ScreenWidth * 0.375), (int) (ScreenHeight * 0.2 * 0.6 * 0.2), 140, 20);
		pl_north_center.add(lb_HotSearch);
		// 搜索文本框
		tf_Search = new JTextField();
		tf_Search.setFont(font);
		tf_Search.setBounds((int) (ScreenWidth * 0.375), (int) (ScreenHeight * 0.2 * 0.6 * 0.44), 225, 30);
		pl_north_center.add(tf_Search);
		// 上部面板输入提示图片
		lb_SearchTips = new JLabel();
		lb_SearchTips.setIcon(new ImageIcon(StackRoom.class.getResource("书库输入提示标签.png")));
		lb_SearchTips.setBounds((int) (ScreenWidth * 0.375), (int) (ScreenHeight * 0.2 * 0.6 * 0.7), 225, 30);
		pl_north_center.add(lb_SearchTips);
		// 上部面板搜索按钮图片
		lb_Search = new JLabel();
		lb_Search.setIcon(new ImageIcon(StackRoom.class.getResource("书库搜索按钮.png")));
		lb_Search.setBounds((int) (ScreenWidth * 0.54), (int) (ScreenHeight * 0.2 * 0.6 * 0.44), 225, 30);
		pl_north_center.add(lb_Search);
		// 上部面板充值按钮
		lb_Recharge = new JLabel();
		lb_Recharge.setIcon(new ImageIcon(StackRoom.class.getResource("书库充值图片.png")));
		lb_Recharge.setBounds((int) (ScreenWidth * 0.69), (int) (ScreenHeight * 0.2 * 0.6 * 0.2), 225, 30);
		pl_north_center.add(lb_Recharge);

		// 上部面板作家中心按钮
		lb_WritersCenter = new JLabel();
		lb_WritersCenter.setIcon(new ImageIcon(StackRoom.class.getResource("书库作家中心图片.png")));
		lb_WritersCenter.setBounds((int) (ScreenWidth * 0.69), (int) (ScreenHeight * 0.2 * 0.6 * 0.5), 225, 30);
		pl_north_center.add(lb_WritersCenter);

		// 上部面板邮件图像登录按钮
		lb_center_loginMail = new JLabel();
		lb_center_loginMail.setIcon(new ImageIcon(StackRoom.class.getResource("书库邮箱图片登录图片.png")));
		lb_center_loginMail.setBounds((int) (ScreenWidth * 0.77), (int) (ScreenHeight * 0.2 * 0.6 * 0.4), 225, 30);
		pl_north_center.add(lb_center_loginMail);

		// 上部面板登录头像图片
		lb_center_loginHeadPicture = new JLabel();
		lb_center_loginHeadPicture.setIcon(new ImageIcon(StackRoom.class.getResource("书库登录注册按钮.png")));
		lb_center_loginHeadPicture.setBounds((int) (ScreenWidth * 0.81), (int) (ScreenHeight * 0.2 * 0.6 * 0.3), 225,
				50);
		pl_north_center.add(lb_center_loginHeadPicture);

		// 上部面板下部
		pl_north_south = new JPanel();
		pl_north_south.setLayout(null);
		pl_north_south.setBackground(new Color(178, 34, 34));
		pl_north_south.setPreferredSize(new Dimension(0, (int) (ScreenHeight * 0.2 * 0.2)));
		pl_north.add(BorderLayout.SOUTH, pl_north_south);

		// 标题文字格式
		font = new Font("微软雅黑", Font.PLAIN, 15);
		// 首页按钮
		lb_FirstPage = new JLabel("首页");
		lb_FirstPage.setFont(font);
		lb_FirstPage.setForeground(Color.white);
		lb_FirstPage.setBounds((int) (ScreenWidth * 0.16), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_FirstPage);

		// 首页隔开按钮
		lb_FirstPagePart = new JLabel("|");
		lb_FirstPagePart.setFont(font);
		lb_FirstPagePart.setForeground(Color.white);
		lb_FirstPagePart.setBounds((int) (ScreenWidth * 0.21), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_FirstPagePart);

		// 书库按钮
		lb_StackRoom = new JLabel("书库");
		lb_StackRoom.setFont(font);
		lb_StackRoom.setForeground(Color.white);
		lb_StackRoom.setBounds((int) (ScreenWidth * 0.24), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_StackRoom);

		// 书库隔开标签
		lb_StackRoomPart = new JLabel("|");
		lb_StackRoomPart.setFont(font);
		lb_StackRoomPart.setForeground(Color.white);
		lb_StackRoomPart.setBounds((int) (ScreenWidth * 0.29), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_StackRoomPart);

		// 排行按钮
		lb_Ranking = new JLabel("排行");
		lb_Ranking.setFont(font);
		lb_Ranking.setForeground(Color.white);
		lb_Ranking.setBounds((int) (ScreenWidth * 0.325), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_Ranking);

		// 排行隔开标签
		lb_RankingPart = new JLabel("|");
		lb_RankingPart.setFont(font);
		lb_RankingPart.setForeground(Color.white);
		lb_RankingPart.setBounds((int) (ScreenWidth * 0.37), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_RankingPart);

		// IP专区按钮
		lb_IpSpecialArea = new JLabel("IP专区");
		lb_IpSpecialArea.setFont(font);
		lb_IpSpecialArea.setForeground(Color.white);
		lb_IpSpecialArea.setBounds((int) (ScreenWidth * 0.4), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_IpSpecialArea);

		// IP专区按钮隔开线
		lb_IpSpecialAreaPart = new JLabel("|");
		lb_IpSpecialAreaPart.setFont(font);
		lb_IpSpecialAreaPart.setForeground(Color.white);
		lb_IpSpecialAreaPart.setBounds((int) (ScreenWidth * 0.455), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_IpSpecialAreaPart);

		// 作家福利按钮
		lb_WriterWelfare = new JLabel("作家福利");
		lb_WriterWelfare.setFont(font);
		lb_WriterWelfare.setForeground(Color.white);
		lb_WriterWelfare.setBounds((int) (ScreenWidth * 0.485), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 100, 30);
		pl_north_south.add(lb_WriterWelfare);

		// 作家福利按钮隔开线
		lb_WriterWelfarePart = new JLabel("|");
		lb_WriterWelfarePart.setFont(font);
		lb_WriterWelfarePart.setForeground(Color.white);
		lb_WriterWelfarePart.setBounds((int) (ScreenWidth * 0.55), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_WriterWelfarePart);

		// 公告资讯按钮
		lb_AnnounceInformation = new JLabel("公告资讯");
		lb_AnnounceInformation.setFont(font);
		lb_AnnounceInformation.setForeground(Color.white);
		lb_AnnounceInformation.setBounds((int) (ScreenWidth * 0.58), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 100, 30);
		pl_north_south.add(lb_AnnounceInformation);

		// 公告资讯按钮隔开线
		lb_AnnounceInformationPart = new JLabel("|");
		lb_AnnounceInformationPart.setFont(font);
		lb_AnnounceInformationPart.setForeground(Color.white);
		lb_AnnounceInformationPart.setBounds((int) (ScreenWidth * 0.645), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50,
				30);
		pl_north_south.add(lb_AnnounceInformationPart);

		// 女生专区按钮
		lb_GirlSpecialArea = new JLabel("女生专区");
		lb_GirlSpecialArea.setFont(font);
		lb_GirlSpecialArea.setForeground(Color.white);
		lb_GirlSpecialArea.setBounds((int) (ScreenWidth * 0.675), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 100, 30);
		pl_north_south.add(lb_GirlSpecialArea);

		// 女生专区按钮隔开线
		lb_GirlSpecialAreaPart = new JLabel("|");
		lb_GirlSpecialAreaPart.setFont(font);
		lb_GirlSpecialAreaPart.setForeground(Color.white);
		lb_GirlSpecialAreaPart.setBounds((int) (ScreenWidth * 0.74), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 50, 30);
		pl_north_south.add(lb_GirlSpecialAreaPart);

		// 我的书架按钮
		lb_MyBookShelf = new JLabel("我的书架");
		lb_MyBookShelf.setFont(font);
		lb_MyBookShelf.setForeground(Color.white);
		lb_MyBookShelf.setBounds((int) (ScreenWidth * 0.77), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 100, 30);
		pl_north_south.add(lb_MyBookShelf);

	}

	// 中部界面
	public void StackRoomCenter(int ScreenWidth, int ScreenHeight,String username,boolean flag) {
		// 书库介绍
		jl_StackRoomCer_introduce = new JLabel();
		ImageIcon im_introduce = new ImageIcon(StackRoom.class.getResource("书库介绍.png"));
		jl_StackRoomCer_introduce.setIcon(im_introduce);
		jl_StackRoomCer_introduce.setBounds((int) (ScreenWidth * 0.075), 0, im_introduce.getIconWidth(),
				im_introduce.getIconHeight());
		jp_StackRoom_center.add(jl_StackRoomCer_introduce);
		// 按排序==菜单面板
		jp_StackRoomCer_SortMenu = new JPanel();
		jp_StackRoomCer_SortMenu.setBounds((int) (ScreenWidth * 0.3), 0, (int) (ScreenWidth * 0.64),
				im_introduce.getIconHeight());
		jp_StackRoomCer_SortMenu.setBackground(Color.WHITE);
		jp_StackRoomCer_SortMenu.setLayout(null);
		jp_StackRoom_center.add(jp_StackRoomCer_SortMenu);
		Font font = new Font("微软雅黑", Font.PLAIN, 13);// 设置字体
		// 添加按str组件
		jl_SortMenu_One = new JLabel[5];
		double w = 0.01;
		String[] str = { "按人气  ↓", "按收藏  ↓", "按推荐  ↓", "按字数  ↓", "按销量  ↓" };
		for (int i = 0; i < jl_SortMenu_One.length; i++) {
			jl_SortMenu_One[i] = new JLabel(str[i]);
			jl_SortMenu_One[i].setFont(font);
			jl_SortMenu_One[i].setCursor(cursor);
			jl_SortMenu_One[i].setBounds((int) (ScreenWidth * w), (int) (ScreenHeight * 0.008),
					(int) (ScreenWidth * 0.04), 30);
			w += 0.06;
			if (i==0) {
				jl_SortMenu_One[i].setForeground(new Color(205, 38, 38));
			}
			jp_StackRoomCer_SortMenu.add(jl_SortMenu_One[i]);
		}
		// 添加 周 月 总
		jl_SortMenu_Two = new JLabel[5];
		String[] str1 = { "周", "|", "月", "|", "总" };
		for (int i = 0; i < jl_SortMenu_Two.length; i++) {
			jl_SortMenu_Two[i] = new JLabel(str1[i]);
			jl_SortMenu_Two[i].setFont(font);
			jl_SortMenu_Two[i].setCursor(cursor);
			jl_SortMenu_Two[i].setBounds((int) (ScreenWidth * w) + (int) (ScreenWidth * 0.25),
					(int) (ScreenHeight * 0.008), (int) (ScreenWidth * 0.01), 30);
			w += 0.015;
			if (i==0) {
				jl_SortMenu_Two[i].setForeground(new Color(205, 38, 38));
			}
			jp_StackRoomCer_SortMenu.add(jl_SortMenu_Two[i]);
		}
		// 类型面板菜单
		jp_StackRoomCer_Type = new JPanel();
		jp_StackRoomCer_Type.setBounds((int) (ScreenWidth * 0.075), (int) (ScreenHeight * 0.06),
				im_introduce.getIconWidth(), (int) (ScreenHeight * 0.65));
		jp_StackRoomCer_Type.setBackground(Color.WHITE);
		jp_StackRoomCer_Type.setLayout(null);
		jp_StackRoom_center.add(jp_StackRoomCer_Type);
		// 各个类型标签
		Font fontType = new Font("微软雅黑", Font.PLAIN, 15);// 设置类型字体
		jl_Type_One = new JLabel[5];
		String[] type = {"分类", "状态", "属性", "字数" };
		for (int i = 0; i < type.length; i++) {
			jl_Type_One[i] = new JLabel(type[i]);
			jl_Type_One[i].setBounds((int) (ScreenWidth * 0.01),
					(int) (ScreenHeight * 0.01) + (int) (ScreenHeight * 0.11 * i), (int) (ScreenWidth * 0.05),
					(int) (ScreenHeight * 0.02));
			if (i == 1) {
				jl_Type_One[i].setBounds((int) (ScreenWidth * 0.01),
						(int) (ScreenHeight * 0.01) + (int) (ScreenHeight * 0.14 * i), (int) (ScreenWidth * 0.05),
						(int) (ScreenHeight * 0.02));
			}
			if (i > 2) {
				jl_Type_One[i].setBounds((int) (ScreenWidth * 0.01),
						(int) (ScreenHeight * 0.05) + (int) (ScreenHeight * 0.11 * i), (int) (ScreenWidth * 0.05),
						(int) (ScreenHeight * 0.02));
			}
			if (i == 3) {
				jl_Type_One[i].setBounds((int) (ScreenWidth * 0.01),
						(int) (ScreenHeight * 0.03) + (int) (ScreenHeight * 0.10 * i), (int) (ScreenWidth * 0.05),
						(int) (ScreenHeight * 0.02));
			}
			jl_Type_One[i].setFont(fontType);
			jl_Type_One[i].setCursor(cursor);
			jp_StackRoomCer_Type.add(jl_Type_One[i]);
		}
		jp_Type_One = new JPanel[4];
		for (int i = 0; i < jp_Type_One.length; i++) {
			jp_Type_One[i] = new JPanel();
			if (i == 0) {
				jp_Type_One[i].setBounds((int) (ScreenWidth * 0.01), (int) (ScreenHeight * 0.034),
						(int) (ScreenWidth * 0.2), (int) (ScreenHeight * 0.10));
			}
			if (i == 1) {
				jp_Type_One[i].setBounds((int) (ScreenWidth * 0.01), (int) (ScreenHeight * 0.176),
						(int) (ScreenWidth * 0.2), (int) (ScreenHeight * 0.05));
			}
			if (i == 2) {
				jp_Type_One[i].setBounds((int) (ScreenWidth * 0.01), (int) (ScreenHeight * 0.26),
						(int) (ScreenWidth * 0.2), (int) (ScreenHeight * 0.05));
			}
			if (i == 3) {
				jp_Type_One[i].setBounds((int) (ScreenWidth * 0.01), (int) (ScreenHeight * 0.35),
						(int) (ScreenWidth * 0.2), (int) (ScreenHeight * 0.12));
			}
			jp_Type_One[i].setLayout(new FlowLayout(FlowLayout.LEFT));
			jp_Type_One[i].setBackground(Color.WHITE);
			jp_StackRoomCer_Type.add(jp_Type_One[i]);
		}
//	 分类标签==按钮
		Font fontLable = new Font("微软雅黑", Font.PLAIN, 13);
		jb_StackRoom_sort = new JButton[11];
		String[] sort = { "全部", "玄幻", "都市", "修真", "网游", "科幻", "武侠", "历史", "军事", "悬疑" };
		for (; i < sort.length; i++) {
			jb_StackRoom_sort[i] = new JButton(sort[i]);
			jb_StackRoom_sort[i].setBackground(Color.white);
			if (sort[i].equals("全部")) {
				jb_StackRoom_sort[i].setBackground(Color.gray);
				jb_StackRoom_sort[i].setForeground(Color.WHITE);
			}
			
			jb_StackRoom_sort[i].setFocusable(false);
			jb_StackRoom_sort[i].setFont(fontLable);
			jb_StackRoom_sort[i].setBorderPainted(false);
			jb_StackRoom_sort[i].setCursor(cursor);
			jp_Type_One[0].add(jb_StackRoom_sort[i]);
		}
		 sort(sort);      

//  状态标签==按钮
		jb_StackRoom_state = new JButton[3];
		String[] state = { "全部", "连载中", "已完成" };
		for (int i = 0; i < state.length; i++) {
			jb_StackRoom_state[i] = new JButton(state[i]);
			jb_StackRoom_state[i].setBackground(Color.white);
			if (state[i].equals("全部")) {
				jb_StackRoom_state[i].setBackground(Color.gray);
				jb_StackRoom_state[i].setForeground(Color.WHITE);
			}
			jb_StackRoom_state[i].setFocusable(false);
			jb_StackRoom_state[i].setFont(fontLable);
			jb_StackRoom_state[i].setBorderPainted(false);
			jb_StackRoom_state[i].setCursor(cursor);
			jp_Type_One[1].add(jb_StackRoom_state[i]);
		}
		state (state);
//  属性标签==按钮
		jb_StackRoom_attribute = new JButton[3];
		String[] attribute = { "不限", "只看免费", "只看VIP" };
		for (int i = 0; i < attribute.length; i++) {
			jb_StackRoom_attribute[i] = new JButton(attribute[i]);
			jb_StackRoom_attribute[i].setBackground(Color.white);
			if (attribute[i].equals("不限")) {
				jb_StackRoom_attribute[i].setBackground(Color.gray);
				jb_StackRoom_attribute[i].setForeground(Color.WHITE);
			}
			jb_StackRoom_attribute[i].setFocusable(false);
			jb_StackRoom_attribute[i].setBorderPainted(false);
			jb_StackRoom_attribute[i].setFont(fontLable);
			jb_StackRoom_attribute[i].setCursor(cursor);
			jp_Type_One[2].add(jb_StackRoom_attribute[i]);
		}
//  字数标签==按钮
		jb_StackRoom_wordNum = new JButton[6];
		String[] wordNum = { "全部", "30万字以下", "30万-50万", "50万-100万", "100万-200万", "200万字以上" };
		for (int i = 0; i < wordNum.length; i++) {
			jb_StackRoom_wordNum[i] = new JButton(wordNum[i]);
			jb_StackRoom_wordNum[i].setBackground(Color.white);
			if (wordNum[i].equals("全部")) {
				jb_StackRoom_wordNum[i].setBackground(Color.gray);
				jb_StackRoom_wordNum[i].setForeground(Color.WHITE);
			}
			jb_StackRoom_wordNum[i].setFocusable(false);
			jb_StackRoom_wordNum[i].setBorderPainted(false);
			jb_StackRoom_wordNum[i].setFont(fontLable);
			jb_StackRoom_wordNum[i].setCursor(cursor);
			jp_Type_One[3].add(jb_StackRoom_wordNum[i]);
		}
		// 展示面板
		jp_StackRoomCer_Display = new JPanel();
		jp_StackRoomCer_Display.setBounds((int) (ScreenWidth * 0.3), (int) (ScreenHeight * 0.06),
				(int) (ScreenWidth * 0.64), (int) (ScreenHeight * 1.8));
		jp_StackRoomCer_Display.setBackground(Color.WHITE);
		jp_StackRoomCer_Display.setLayout(new GridLayout(8, 2, 10, 5));
		jp_StackRoom_center.add(jp_StackRoomCer_Display);
		// 展示内容
		jp_StackRoomDisplay_content = new JPanel[16];
		for (int i = 0; i < jp_StackRoomDisplay_content.length; i++) {
			jp_StackRoomDisplay_content[i] = new JPanel();
			jp_StackRoomDisplay_content[i].setBackground(Color.WHITE);
			jp_StackRoomDisplay_content[i].setLayout(null);
			jp_StackRoomCer_Display.add(jp_StackRoomDisplay_content[i]);
		}
		// 展示图片面板
		jp_StackRoomDisplay_img = new JPanel[16];
		for (int i = 0; i < jp_StackRoomDisplay_img.length; i++) {
			jp_StackRoomDisplay_img[i] = new JPanel();
			jp_StackRoomDisplay_img[i].setBounds((int) (ScreenWidth * 0.008), (int) (ScreenHeight * 0.01),
					(int) (ScreenWidth * 0.09), (int) (ScreenHeight * 0.20));
			jp_StackRoomDisplay_img[i].setBackground(Color.WHITE);
			jp_StackRoomDisplay_img[i].setLayout(null);
			jp_StackRoomDisplay_content[i].add(jp_StackRoomDisplay_img[i]);
		}

//		Test.download(listName, Test.img()); // 小说图片
	
		jl_Type_im = new JLabel[16];
		im = new ImageIcon[16];
		listName = Test.name();// 小说名字
		for (int i = 0; i < jl_Type_im.length; i++) {
			jl_Type_im[i] = new JLabel();
			im[i] = new ImageIcon("E://demo/书库图片/" + listName.get(i) + ".png");
			im[i].setImage(im[i].getImage().getScaledInstance((int) (ScreenWidth * 0.09), (int) (ScreenHeight * 0.20),
					Image.SCALE_DEFAULT));
			jl_Type_im[i].setIcon(im[i]);
			jl_Type_im[i].setBounds(0, 0, im[i].getIconWidth(), im[i].getIconHeight());
			jl_Type_im[i].setCursor(cursor);
			imgListener(im[i],jl_Type_im[i],listName.get(i).toString(),username,flag);
			jp_StackRoomDisplay_img[i].add(jl_Type_im[i]);
		}
		// 小说名字
		jl_novel_name = new JLabel[16];
		for (int i = 0; i < jl_novel_name.length; i++) { 
			jl_novel_name[i] = new JLabel(listName.get(i));
			jl_novel_name[i].setBounds((int) (ScreenWidth * 0.12), (int) (ScreenHeight * 0.002),
					(int) (ScreenWidth * 0.15), (int) (ScreenHeight * 0.05));
			jl_novel_name[i].setFont(fontType);
			imgListener(im[i],jl_novel_name[i],listName.get(i).toString(),username,flag);
			jl_novel_name[i].setCursor(cursor);
			jp_StackRoomDisplay_content[i].add(jl_novel_name[i]);
		}
		// 小说简介
		jt_novel_synopsis = new JTextArea[16];
		listSynopsis = Test.synopsis();// 小说简介
		for (int i = 0; i < jt_novel_synopsis.length; i++) {
			jt_novel_synopsis[i] = new JTextArea(listSynopsis.get(i).trim());
			jt_novel_synopsis[i].setBounds((int) (ScreenWidth * 0.12), (int) (ScreenHeight * 0.08),
					(int) (ScreenWidth * 0.18), (int) (ScreenHeight * 0.075));
			jt_novel_synopsis[i].setFont(fontLable);
			jt_novel_synopsis[i].setLineWrap(true); // 激活自动换行功能
			jt_novel_synopsis[i].setWrapStyleWord(true); // 不断字
			jt_novel_synopsis[i].setEnabled(false);
			jp_StackRoomDisplay_content[i].add(jt_novel_synopsis[i]);
		}
		listType = Test.type();// 小说类型	 
		// 小说类型
		jl_novel_type = new JLabel[16];
		for (int i = 0; i < jl_novel_type.length; i++) {
			jl_novel_type[i] = new JLabel(listType.get(i));
			jl_novel_type[i].setBounds((int) (ScreenWidth * 0.12), (int) (ScreenHeight * 0.05),
					(int) (ScreenWidth * 0.025), (int) (ScreenHeight * 0.025));
			jl_novel_type[i].setFont(fontLable);
			jl_novel_type[i].setBorder(BorderFactory.createEtchedBorder());
			jl_novel_type[i].add(new JLabel());
			jl_novel_type[i].setBackground(new Color(0, 160, 178));
			jl_novel_type[i].setForeground(new Color(0, 160, 178));
			jp_StackRoomDisplay_content[i].add(jl_novel_type[i]);
		}
		// 小说字数
		jl_novel_totalNum = new JLabel[16];
		listNum = Test.wordNum(); // 小说总字数
		for (int i = 0; i < jl_novel_totalNum.length; i++) {
			jl_novel_totalNum[i] = new JLabel("小说字数:" + listNum.get(i));
			jl_novel_totalNum[i].setBounds((int) (ScreenWidth * 0.16), (int) (ScreenHeight * 0.05),
					(int) (ScreenWidth * 0.15), (int) (ScreenHeight * 0.025));
			jl_novel_totalNum[i].setFont(fontLable);
			jl_novel_totalNum[i].setForeground(new Color(178, 34, 34));
			jp_StackRoomDisplay_content[i].add(jl_novel_totalNum[i]);
		}
		// 小说更新时间
		jl_novel_updateTime = new JLabel[16];
		ListUpdate = Test.updateTime();// 小说更新时间
		for (int i = 0; i < jl_novel_updateTime.length; i++) {
			jl_novel_updateTime[i] = new JLabel(ListUpdate.get(i));
			jl_novel_updateTime[i].setBounds((int) (ScreenWidth * 0.12), (int) (ScreenHeight * 0.165),
					(int) (ScreenWidth * 0.14), (int) (ScreenHeight * 0.025));
			jl_novel_updateTime[i].setFont(fontLable);
			jl_novel_updateTime[i].setForeground(Color.GRAY);
			jp_StackRoomDisplay_content[i].add(jl_novel_updateTime[i]);
		}
   	      // 小说状态
		jl_novel_state = new JLabel[16];
		ListState = Test.state();// 小说状态
		for (int i = 0; i < jl_novel_state.length; i++) {
			jl_novel_state[i] = new JLabel(ListState.get(i));
			jl_novel_state[i].setBounds((int) (ScreenWidth * 0.24), (int) (ScreenHeight * 0.165),
					(int) (ScreenWidth * 0.05), (int) (ScreenHeight * 0.025));
			jl_novel_state[i].setFont(fontLable);
			jl_novel_state[i].setForeground(Color.GRAY);
			jp_StackRoomDisplay_content[i].add(jl_novel_state[i]);
		}
		// 切换面板
		jp_StackRoomCer_Change = new JPanel();
		jp_StackRoomCer_Change.setBounds((int) (ScreenWidth * 0.3), (int) (ScreenHeight * 1.87),
				(int) (ScreenWidth * 0.64), (int) (ScreenHeight * 0.05));
		jp_StackRoomCer_Change.setLayout(null);
		jp_StackRoom_center.add(jp_StackRoomCer_Change);
		// 切换页码
		jb_StackRoomChange_page = new JButton[5];
		String[] page = { "1", "2", "3", "4", "5" };
		for (int i = 0; i < page.length; i++) {
			jb_StackRoomChange_page[i] = new JButton(page[i]);
			jb_StackRoomChange_page[i].setBounds((int) (ScreenWidth * 0.23) + (int) (ScreenWidth * 0.025 * i),
					(int) (ScreenHeight * 0.006), (int) (ScreenWidth * 0.02), (int) (ScreenHeight * 0.04));
			jb_StackRoomChange_page[i].setBackground(new Color(245, 245, 245));
			if (i == 0) {
				jb_StackRoomChange_page[i].setBackground(new Color(205, 38, 38));
				jb_StackRoomChange_page[i].setForeground(Color.WHITE);
			}
			jb_StackRoomChange_page[i].setFocusable(false);
			jb_StackRoomChange_page[i].setBorderPainted(false);
			jb_StackRoomChange_page[i].setFont(fontType);
			jb_StackRoomChange_page[i].setCursor(cursor);
			jp_StackRoomCer_Change.add(jb_StackRoomChange_page[i]);
		}
		// 切换省略号
		jl_page_ellipsis = new JLabel("... ...");
		jl_page_ellipsis.setBounds((int) (ScreenWidth * 0.355), (int) (ScreenHeight * 0.003),
				(int) (ScreenWidth * 0.03), (int) (ScreenHeight * 0.04));
		jl_page_ellipsis.setFont(fontType);
		jp_StackRoomCer_Change.add(jl_page_ellipsis);
		// 上一页 下一页
		jb_page_change = new JButton[2];
		String[] change = { "上一页", "下一页" };
		for (int i = 0; i < change.length; i++) {
			jb_page_change[i] = new JButton(change[i]);
			jb_page_change[i].setBounds((int) (ScreenWidth * 0.17) + (int) (ScreenWidth * 0.21 * i),
					(int) (ScreenHeight * 0.006), (int) (ScreenWidth * 0.05), (int) (ScreenHeight * 0.04));
			jb_page_change[i].setBackground(new Color(245, 245, 245));
			jb_page_change[i].setFont(fontType);
			jb_page_change[i].setFocusable(false);
			jb_page_change[i].setBorderPainted(false);
			jb_page_change[i].setCursor(cursor);
			jp_StackRoomCer_Change.add(jb_page_change[i]);
		}
		jl_page_total = new JLabel("共1/10页");
		jl_page_total.setBounds((int) (ScreenWidth * 0.43), (int) (ScreenHeight * 0.006), (int) (ScreenWidth * 0.05),
				(int) (ScreenHeight * 0.04));
		jl_page_total.setFont(fontType);
		jp_StackRoomCer_Change.add(jl_page_total);
	}
	
	
  public void imgListener(ImageIcon im,JLabel jl,String book,String username,boolean flag) {
	  jl.addMouseListener(new MouseAdapter() {
		  @Override
		public void mouseClicked(MouseEvent e) {
		new ClickLaterFrame(im,book,username,flag);
		     dispose();
		}
	});
}


	public static void main(String[] args) {
		try {
			//////////////////////// ---------------------------------- select Look and
			//////////////////////// Feel(下面就是要改变的地方了)
			JFrame.setDefaultLookAndFeelDecorated(true);
			UIManager.setLookAndFeel("com.jtattoo.plaf.fast.FastLookAndFeel");
			//////////////////////// ---------------------------------- start application
			new StackRoom("lgw",false);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	public void  state (String[] state) {
		jb_StackRoom_state[0].addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				jb_StackRoom_state[0].setBackground(Color.gray);
				jb_StackRoom_state[0].setForeground(Color.WHITE);
				for (int j = 0; j < state.length; j++) {
					if (j != 2) {
						jb_StackRoom_state[0].setBackground(Color.WHITE);
						jb_StackRoom_state[0].setForeground(Color.black);
					}
				}
			}
		});
		jb_StackRoom_state[0].addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				jb_StackRoom_state[0].setBackground(Color.gray);
				jb_StackRoom_state[0].setForeground(Color.WHITE);
				for (int j = 0; j < state.length; j++) {
					if (j != 2) {
						jb_StackRoom_state[j].setBackground(Color.WHITE);
						jb_StackRoom_state[j].setForeground(Color.black);
					}
				}
			}
		});
		jb_StackRoom_state[1].addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				jb_StackRoom_state[1].setBackground(Color.gray);
				jb_StackRoom_state[1].setForeground(Color.WHITE);
				for (int j = 0; j < state.length; j++) {
					if (j != 1) {
						jb_StackRoom_state[j].setBackground(Color.WHITE);
						jb_StackRoom_state[j].setForeground(Color.black);
					}
				}
			}
		});
		jb_StackRoom_state[2].addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				jb_StackRoom_state[2].setBackground(Color.gray);
				jb_StackRoom_state[2].setForeground(Color.WHITE);
				for (int j = 0; j < state.length; j++) {
					if (j != 2) {
						jb_StackRoom_state[j].setBackground(Color.WHITE);
						jb_StackRoom_state[j].setForeground(Color.black);
					}
				}
			}
		});
	}
	public void  sort(String[]sort) {
			jb_StackRoom_sort[1].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[1].setBackground(Color.gray);
					jb_StackRoom_sort[1].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 1) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[2].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[2].setBackground(Color.gray);
					jb_StackRoom_sort[2].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 2) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[3].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[3].setBackground(Color.gray);
					jb_StackRoom_sort[3].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 3) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[4].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[4].setBackground(Color.gray);
					jb_StackRoom_sort[4].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 4) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[5].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[5].setBackground(Color.gray);
					jb_StackRoom_sort[5].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 5) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[6].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[6].setBackground(Color.gray);
					jb_StackRoom_sort[6].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 6) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[7].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[7].setBackground(Color.gray);
					jb_StackRoom_sort[7].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 7) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[8].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[8].setBackground(Color.gray);
					jb_StackRoom_sort[8].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 8) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[9].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[9].setBackground(Color.gray);
					jb_StackRoom_sort[9].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 9) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
			jb_StackRoom_sort[0].addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					jb_StackRoom_sort[0].setBackground(Color.gray);
					jb_StackRoom_sort[0].setForeground(Color.WHITE);
					for (int j = 0; j < sort.length; j++) {
						if (j != 0) {
							jb_StackRoom_sort[j].setBackground(Color.WHITE);
							jb_StackRoom_sort[j].setForeground(Color.black);
						}
					}
				}
			});
	

	
	
	}
}